package gepes.servlet;

import gepes.exepcion.DAOExcepcion;
import gepes.modelo.PagoEstudiante;
import gepes.modelo.PagoProfesor;
import gepes.negocio.GestionPagoEstudiante;
import gepes.negocio.GestionPublicacion;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class PagoProfesorBusca
 */
@WebServlet("/PagoProfesorBusca")
public class PagoProfesorBusca extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public PagoProfesorBusca() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		int numero1 = Integer.parseInt(request.getParameter("codprofesor"));
		GestionPublicacion negocio = new GestionPublicacion();
		ArrayList<Object[]> numeros;
		try {
			numeros = (ArrayList<Object[]>) negocio.reporte(numero1);		
			request.setAttribute("pagos", numeros);
		} catch (DAOExcepcion e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		RequestDispatcher rd = request.getRequestDispatcher("Historia9.jsp");
		rd.forward(request, response);
	}

}
